/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Home-pc
 * Date: 2023-08-18
 * Time: 21:41
 */
public class Login {
    private String username="admin";
    private String password="123456";
    public void loginInfo(String username,String password) throws PasswordException,UserNameException{
        if(!this.username.equals(username)){
            throw new UserNameException("用户名异常");
        }
        if(!this.password.equals(password)){
            throw new PasswordException("密码错误");
        }
        System.out.println("登录成功");
    }

    public static void main(String[] args) {
        Login login=new Login();
        try{
            login.loginInfo("admin","123");
        } catch (UserNameException e) {
            e.printStackTrace();
        }catch (PasswordException e) {
            e.printStackTrace();
        }
    }


}
